// pages/my/my.js
Page({
  data: {
    globalData: getApp().globalData,
    userFlag: false,
    user: {},
    vip: ''
  },

  onShow(options) {
    if(wx.getStorageSync('user') != '') {
      this.setData({
        userFlag: true,
        user: wx.getStorageSync('user')
      })
      this.setVip()
    }
  },

  toLogin() {
    wx.navigateTo({url: '/pages/login/login',})
  },
  toUser() {
    wx.navigateTo({url: '/pages/user/user',})
  },
  toOrder(e) {
    wx.navigateTo({url: '/pages/order/order?status=' + e.currentTarget.dataset.status})
  },
  toVip() {
    wx.navigateTo({url: '/pages/vip/vip',})
  },
  setVip() {
    let member = this.data.user.member
    if(member == 0) {
      this.setData({vip: '无会员'})
    } else if(member == 1) {
      this.setData({vip: '铜卡会员'})
    } else if(member == 2) {
      this.setData({vip: '银卡会员'})
    } else if(member == 3) {
      this.setData({vip: '金卡会员'})
    }
  },
  showAbout() {
    wx.showModal({
      title: '欢迎访问茶都商城',
      content: '电话：123456789\n地址：河北省石家庄市桥西区',
      showCancel: false
    })
  }

})